﻿CREATE FUNCTION [dbo].[fn_CRUDProcs] ()
RETURNS TABLE
AS
	RETURN (
	    SELECT TOP 100 PERCENT p.[name] AS 'ProcedureName'
	    FROM   sys.procedures p
	    WHERE  p.[name] LIKE 'USP[_]%[_]%'
	           AND (
	                   RIGHT(p.[name], 4) IN ('_Ins', '_Upd', '_Sel', '_Del')
	                   OR RIGHT(p.[name], 7) = '_SelAll'
	                   OR RIGHT(p.[name], 6) = '_SelBy'
	               )
	    ORDER BY
	           p.[name]
	)